package pl.edu.agh.inpema.components.receivers.textFileReceiver;

import java.util.Map;

import pl.edu.agh.inpema.core.components.ReceiverUtil;
import pl.edu.agh.inpema.core.configuration.ConfigurationException;
import pl.edu.agh.inpema.core.model.Receiver;

public class SimpleTextFileReceiver implements Receiver {
	
	private SimpleTextFileReceiverRunner runner;
	
	private static final String[] messageFieldTypes = {
		FIELD_IP, FIELD_DATE, FIELD_TEXT
	};
	
	public SimpleTextFileReceiver() {
		this.runner = new SimpleTextFileReceiverRunner();
	}

	public void setReceiverUtil(ReceiverUtil util) {
		this.runner.setReceiverUtil(util);
	}
	
	public ReceiverUtil getReceiverUtil() {
		return this.runner.getReceiverUtil();
	}
	
	public void startGathering() {
		this.runner.setRunning(true);
		this.runner.start();
	}
	
	public boolean stopGathering() {
		this.runner.setRunning(false);
		return this.runner.isError();
	}
	
	public boolean isGatheringRunning() {
		return this.runner.isRunning();
	}
	
	public void setTimeout(int timeout) {
		this.runner.setTimeout(timeout);
	}
	
	public void setDataFileName(String fileName) {
		this.runner.setDataFile(fileName);
	}
	
	public String[] getMessageFieldTypes() {
		return messageFieldTypes;
	}
}
